<template>

	<!--  忘记密码	-->
	<Forgot  v-if="loginStatus === 4" />

	<div v-else class="login-container">
		<div class="login-simple">
			<div class="login-left">
				<img  src="https://ouan-retail.oss-cn-shenzhen.aliyuncs.com/web/%E7%99%BB%E5%BD%95%E8%83%8C%E6%99%AF.png" alt="">
			</div>
			<div class="login-right">

				<div class="right-qrcode" v-if="loginStatus !== 3">
					<span @click="switchType(3)">微信扫码登录</span>
					<img @click="switchType(3)" src="https://ouan-retail.oss-cn-shenzhen.aliyuncs.com/web/login/Mask%20group.png" alt="">
				</div>
				<div class="right-qrcode" v-else>
					<span @click="switchType(0)">账号密码登录</span>
					<img @click="switchType(0)" src="https://ouan-retail.oss-cn-shenzhen.aliyuncs.com/web/login/%E5%AF%86%E7%A0%81%E7%99%BB%E5%BD%95.png" alt="">
				</div>

				<div class="right-box">

					<div class="right-title" v-if="loginStatus < 3">
						<div class="right-title-box" :class="{'title-active' : loginStatus == 0 || loginStatus == 2}" @click="switchType(0)">登录</div>
						<div class="right-title-box" :class="{'title-active' : loginStatus == 1}" @click="switchType(1)">注册</div>
					</div>

					<!--		密码登录			-->
					<Account v-if="loginStatus === 0" @switch-type="switchType" />

					<!--		验证码登录			-->
					<Mobile v-if="loginStatus === 2" @switch-type="switchType" />

					<!--		注册			-->
					<Register v-if="loginStatus === 1" @switch-type="switchType" />

					<!--		微信登录			-->
					<WechatLogin v-if="loginStatus === 3" @switch-type="switchType" />

				</div>

			</div>
		</div>
	</div>
</template>

<script setup lang="ts">
import { ref, onMounted, reactive, computed } from 'vue';
import { NextLoading } from '/@/utils/loading';

// 引入组件
import Register from '/@/views/login/component/register.vue';
import Account from '/@/views/login/component/account.vue';
import Mobile from '/@/views/login/component/mobile.vue';
import Forgot from '/@/views/login/component/forgot.vue';
import WechatLogin from '/@/views/login/component/wechat_login.vue';

// 定义变量内容
const loginStatus = ref(0) // 0：登录，1：注册，2：手机验证码，3：微信登录, 4:忘记密码

const switchType = (type: number) => {
	loginStatus.value = type
}

// 页面加载时
onMounted(() => {
	NextLoading.done();
});
</script>

<style lang="scss">
.el-checkbox__input.is-checked .el-checkbox__inner {
	background-color: #FC661C !important;
	border-color: rgba(252,102,28,0.5) !important;
}
.el-checkbox__label p:hover {
	color: #FC661C !important;
}
@media screen and (max-width: 1000px) {
	.login-container {
		.login-simple {
			width: 422px !important;
			position: relative;

			.login-left {
				display: none;
			}

			.login-right {
				width: 422px !important;
				height: 100vh !important;
				position: absolute;
				top: 0;
				left: 0;
				background: linear-gradient(to bottom, #fff1f0, #ffe1d3, #ffd4b3);

				.right-box {
					margin-top: 30% !important;
				}
			}
		}
	}
}
.login-container {
	display: grid;
	place-items: center; /* 垂直和水平居中的简写 */
	height: 100vh;
	background: #F2F4F7;

	.login-simple {
		display: flex;
		justify-content: center;

		.login-left {
			width: 422px;
			height: 600px;

			img {
				width: 100%;
				height: 100%;
			}
		}

		.login-right {
			width: 578px;
			height: 600px;
			background-color: #FFFFFF;
			position: relative;

			.right-qrcode {
				display: flex;
				justify-content: flex-end;
				align-items: center;

				span {
					width: 118px;
					height: 33px;
					font-weight: 400;
					font-size: 14px;
					color: #FC661C;
					line-height: 33px;
					text-align: center;
					cursor: pointer;
					background-image: url("https://ouan-retail.oss-cn-shenzhen.aliyuncs.com/web/login/Rectangle_183.png");
					background-size: 100% 100%;
					background-repeat: no-repeat;
					z-index: 0;
				}

				img {
					width: 70px;
					height: 70px;
					cursor: pointer;
				}
			}

			.right-box {
				width: 380px;
				margin: 18px auto 0;

				.right-title {
					display: flex;
					align-items: center;
					justify-content: space-between;

					.right-title-box {
						width: 158px;
						height: 44px;
						line-height: 44px;
						text-align: center;
						font-size: 20px;
						color: #666666;
						cursor: pointer;
						border-bottom: 1px solid #ECECEC;
					}

					.title-active {
						font-size: 20px;
						color: #000000;
						border-bottom: 4px solid #FC661C;
						transition: 0.2s;
					}
				}

			}
		}
	}
}



.form-tips {
	display: inline-block;
	margin-top: 8px;
	position: relative;

	p {
		font-size: 12px;
		color: #D8232A;
		text-indent: 20px;
	}

	p::before {
		content: url("https://ouan-retail.oss-cn-shenzhen.aliyuncs.com/web/icon/%E6%8F%90%E7%A4%BA.png");
		width: 16px;
		height: 16px;
		position: absolute;
		left: -20px;
		top: 50%;
		transform: translateY(-50%);
		padding-right: 5px;
	}
}
</style>
